/**
 * <copyright>
 * </copyright>
 *

 */
package scerbak.usecases.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import scerbak.usecases.ActionStep;
import scerbak.usecases.Actor;
import scerbak.usecases.Condition;
import scerbak.usecases.Extension;
import scerbak.usecases.Interest;
import scerbak.usecases.Issue;
import scerbak.usecases.Level;
import scerbak.usecases.Scope;
import scerbak.usecases.Trigger;
import scerbak.usecases.UseCase;
import scerbak.usecases.UsecasesPackage;
import scerbak.usecases.Variant;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Use Case</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getName <em>Name</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getDescription <em>Description</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getScope <em>Scope</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getLevel <em>Level</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getPrimaryActor <em>Primary Actor</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getSecondaryActors <em>Secondary Actors</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getTertiaryActors <em>Tertiary Actors</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getInterests <em>Interests</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getPreconditions <em>Preconditions</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getPostconditions <em>Postconditions</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getInvariants <em>Invariants</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getTrigger <em>Trigger</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getSteps <em>Steps</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getExtensions <em>Extensions</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getVariants <em>Variants</em>}</li>
 *   <li>{@link scerbak.usecases.impl.UseCaseImpl#getIssues <em>Issues</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class UseCaseImpl extends MinimalEObjectImpl.Container implements UseCase
{
  /**
   * The default value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected static final String NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected String name = NAME_EDEFAULT;

  /**
   * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDescription()
   * @generated
   * @ordered
   */
  protected static final String DESCRIPTION_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDescription()
   * @generated
   * @ordered
   */
  protected String description = DESCRIPTION_EDEFAULT;

  /**
   * The cached value of the '{@link #getScope() <em>Scope</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getScope()
   * @generated
   * @ordered
   */
  protected Scope scope;

  /**
   * The default value of the '{@link #getLevel() <em>Level</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getLevel()
   * @generated
   * @ordered
   */
  protected static final Level LEVEL_EDEFAULT = Level.SUMMARY;

  /**
   * The cached value of the '{@link #getLevel() <em>Level</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getLevel()
   * @generated
   * @ordered
   */
  protected Level level = LEVEL_EDEFAULT;

  /**
   * The cached value of the '{@link #getPrimaryActor() <em>Primary Actor</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPrimaryActor()
   * @generated
   * @ordered
   */
  protected Actor primaryActor;

  /**
   * The cached value of the '{@link #getSecondaryActors() <em>Secondary Actors</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSecondaryActors()
   * @generated
   * @ordered
   */
  protected EList<Actor> secondaryActors;

  /**
   * The cached value of the '{@link #getTertiaryActors() <em>Tertiary Actors</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTertiaryActors()
   * @generated
   * @ordered
   */
  protected EList<Actor> tertiaryActors;

  /**
   * The cached value of the '{@link #getInterests() <em>Interests</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getInterests()
   * @generated
   * @ordered
   */
  protected EList<Interest> interests;

  /**
   * The cached value of the '{@link #getPreconditions() <em>Preconditions</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPreconditions()
   * @generated
   * @ordered
   */
  protected EList<Condition> preconditions;

  /**
   * The cached value of the '{@link #getPostconditions() <em>Postconditions</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPostconditions()
   * @generated
   * @ordered
   */
  protected EList<Condition> postconditions;

  /**
   * The cached value of the '{@link #getInvariants() <em>Invariants</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getInvariants()
   * @generated
   * @ordered
   */
  protected EList<Condition> invariants;

  /**
   * The cached value of the '{@link #getTrigger() <em>Trigger</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTrigger()
   * @generated
   * @ordered
   */
  protected Trigger trigger;

  /**
   * The cached value of the '{@link #getSteps() <em>Steps</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSteps()
   * @generated
   * @ordered
   */
  protected EList<ActionStep> steps;

  /**
   * The cached value of the '{@link #getExtensions() <em>Extensions</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getExtensions()
   * @generated
   * @ordered
   */
  protected EList<Extension> extensions;

  /**
   * The cached value of the '{@link #getVariants() <em>Variants</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getVariants()
   * @generated
   * @ordered
   */
  protected EList<Variant> variants;

  /**
   * The cached value of the '{@link #getIssues() <em>Issues</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getIssues()
   * @generated
   * @ordered
   */
  protected EList<Issue> issues;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected UseCaseImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return UsecasesPackage.Literals.USE_CASE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getName()
  {
    return name;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setName(String newName)
  {
    String oldName = name;
    name = newName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, UsecasesPackage.USE_CASE__NAME, oldName, name));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getDescription()
  {
    return description;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDescription(String newDescription)
  {
    String oldDescription = description;
    description = newDescription;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, UsecasesPackage.USE_CASE__DESCRIPTION, oldDescription, description));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Scope getScope()
  {
    return scope;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetScope(Scope newScope, NotificationChain msgs)
  {
    Scope oldScope = scope;
    scope = newScope;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UsecasesPackage.USE_CASE__SCOPE, oldScope, newScope);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setScope(Scope newScope)
  {
    if (newScope != scope)
    {
      NotificationChain msgs = null;
      if (scope != null)
        msgs = ((InternalEObject)scope).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UsecasesPackage.USE_CASE__SCOPE, null, msgs);
      if (newScope != null)
        msgs = ((InternalEObject)newScope).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UsecasesPackage.USE_CASE__SCOPE, null, msgs);
      msgs = basicSetScope(newScope, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, UsecasesPackage.USE_CASE__SCOPE, newScope, newScope));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Level getLevel()
  {
    return level;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setLevel(Level newLevel)
  {
    Level oldLevel = level;
    level = newLevel == null ? LEVEL_EDEFAULT : newLevel;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, UsecasesPackage.USE_CASE__LEVEL, oldLevel, level));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Actor getPrimaryActor()
  {
    return primaryActor;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetPrimaryActor(Actor newPrimaryActor, NotificationChain msgs)
  {
    Actor oldPrimaryActor = primaryActor;
    primaryActor = newPrimaryActor;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UsecasesPackage.USE_CASE__PRIMARY_ACTOR, oldPrimaryActor, newPrimaryActor);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setPrimaryActor(Actor newPrimaryActor)
  {
    if (newPrimaryActor != primaryActor)
    {
      NotificationChain msgs = null;
      if (primaryActor != null)
        msgs = ((InternalEObject)primaryActor).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UsecasesPackage.USE_CASE__PRIMARY_ACTOR, null, msgs);
      if (newPrimaryActor != null)
        msgs = ((InternalEObject)newPrimaryActor).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UsecasesPackage.USE_CASE__PRIMARY_ACTOR, null, msgs);
      msgs = basicSetPrimaryActor(newPrimaryActor, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, UsecasesPackage.USE_CASE__PRIMARY_ACTOR, newPrimaryActor, newPrimaryActor));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Actor> getSecondaryActors()
  {
    if (secondaryActors == null)
    {
      secondaryActors = new EObjectContainmentEList<Actor>(Actor.class, this, UsecasesPackage.USE_CASE__SECONDARY_ACTORS);
    }
    return secondaryActors;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Actor> getTertiaryActors()
  {
    if (tertiaryActors == null)
    {
      tertiaryActors = new EObjectContainmentEList<Actor>(Actor.class, this, UsecasesPackage.USE_CASE__TERTIARY_ACTORS);
    }
    return tertiaryActors;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Interest> getInterests()
  {
    if (interests == null)
    {
      interests = new EObjectContainmentEList<Interest>(Interest.class, this, UsecasesPackage.USE_CASE__INTERESTS);
    }
    return interests;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Condition> getPreconditions()
  {
    if (preconditions == null)
    {
      preconditions = new EObjectContainmentEList<Condition>(Condition.class, this, UsecasesPackage.USE_CASE__PRECONDITIONS);
    }
    return preconditions;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Condition> getPostconditions()
  {
    if (postconditions == null)
    {
      postconditions = new EObjectContainmentEList<Condition>(Condition.class, this, UsecasesPackage.USE_CASE__POSTCONDITIONS);
    }
    return postconditions;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Condition> getInvariants()
  {
    if (invariants == null)
    {
      invariants = new EObjectContainmentEList<Condition>(Condition.class, this, UsecasesPackage.USE_CASE__INVARIANTS);
    }
    return invariants;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Trigger getTrigger()
  {
    return trigger;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetTrigger(Trigger newTrigger, NotificationChain msgs)
  {
    Trigger oldTrigger = trigger;
    trigger = newTrigger;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UsecasesPackage.USE_CASE__TRIGGER, oldTrigger, newTrigger);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTrigger(Trigger newTrigger)
  {
    if (newTrigger != trigger)
    {
      NotificationChain msgs = null;
      if (trigger != null)
        msgs = ((InternalEObject)trigger).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UsecasesPackage.USE_CASE__TRIGGER, null, msgs);
      if (newTrigger != null)
        msgs = ((InternalEObject)newTrigger).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UsecasesPackage.USE_CASE__TRIGGER, null, msgs);
      msgs = basicSetTrigger(newTrigger, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, UsecasesPackage.USE_CASE__TRIGGER, newTrigger, newTrigger));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<ActionStep> getSteps()
  {
    if (steps == null)
    {
      steps = new EObjectContainmentEList<ActionStep>(ActionStep.class, this, UsecasesPackage.USE_CASE__STEPS);
    }
    return steps;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Extension> getExtensions()
  {
    if (extensions == null)
    {
      extensions = new EObjectContainmentEList<Extension>(Extension.class, this, UsecasesPackage.USE_CASE__EXTENSIONS);
    }
    return extensions;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Variant> getVariants()
  {
    if (variants == null)
    {
      variants = new EObjectContainmentEList<Variant>(Variant.class, this, UsecasesPackage.USE_CASE__VARIANTS);
    }
    return variants;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Issue> getIssues()
  {
    if (issues == null)
    {
      issues = new EObjectContainmentEList<Issue>(Issue.class, this, UsecasesPackage.USE_CASE__ISSUES);
    }
    return issues;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case UsecasesPackage.USE_CASE__SCOPE:
        return basicSetScope(null, msgs);
      case UsecasesPackage.USE_CASE__PRIMARY_ACTOR:
        return basicSetPrimaryActor(null, msgs);
      case UsecasesPackage.USE_CASE__SECONDARY_ACTORS:
        return ((InternalEList<?>)getSecondaryActors()).basicRemove(otherEnd, msgs);
      case UsecasesPackage.USE_CASE__TERTIARY_ACTORS:
        return ((InternalEList<?>)getTertiaryActors()).basicRemove(otherEnd, msgs);
      case UsecasesPackage.USE_CASE__INTERESTS:
        return ((InternalEList<?>)getInterests()).basicRemove(otherEnd, msgs);
      case UsecasesPackage.USE_CASE__PRECONDITIONS:
        return ((InternalEList<?>)getPreconditions()).basicRemove(otherEnd, msgs);
      case UsecasesPackage.USE_CASE__POSTCONDITIONS:
        return ((InternalEList<?>)getPostconditions()).basicRemove(otherEnd, msgs);
      case UsecasesPackage.USE_CASE__INVARIANTS:
        return ((InternalEList<?>)getInvariants()).basicRemove(otherEnd, msgs);
      case UsecasesPackage.USE_CASE__TRIGGER:
        return basicSetTrigger(null, msgs);
      case UsecasesPackage.USE_CASE__STEPS:
        return ((InternalEList<?>)getSteps()).basicRemove(otherEnd, msgs);
      case UsecasesPackage.USE_CASE__EXTENSIONS:
        return ((InternalEList<?>)getExtensions()).basicRemove(otherEnd, msgs);
      case UsecasesPackage.USE_CASE__VARIANTS:
        return ((InternalEList<?>)getVariants()).basicRemove(otherEnd, msgs);
      case UsecasesPackage.USE_CASE__ISSUES:
        return ((InternalEList<?>)getIssues()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case UsecasesPackage.USE_CASE__NAME:
        return getName();
      case UsecasesPackage.USE_CASE__DESCRIPTION:
        return getDescription();
      case UsecasesPackage.USE_CASE__SCOPE:
        return getScope();
      case UsecasesPackage.USE_CASE__LEVEL:
        return getLevel();
      case UsecasesPackage.USE_CASE__PRIMARY_ACTOR:
        return getPrimaryActor();
      case UsecasesPackage.USE_CASE__SECONDARY_ACTORS:
        return getSecondaryActors();
      case UsecasesPackage.USE_CASE__TERTIARY_ACTORS:
        return getTertiaryActors();
      case UsecasesPackage.USE_CASE__INTERESTS:
        return getInterests();
      case UsecasesPackage.USE_CASE__PRECONDITIONS:
        return getPreconditions();
      case UsecasesPackage.USE_CASE__POSTCONDITIONS:
        return getPostconditions();
      case UsecasesPackage.USE_CASE__INVARIANTS:
        return getInvariants();
      case UsecasesPackage.USE_CASE__TRIGGER:
        return getTrigger();
      case UsecasesPackage.USE_CASE__STEPS:
        return getSteps();
      case UsecasesPackage.USE_CASE__EXTENSIONS:
        return getExtensions();
      case UsecasesPackage.USE_CASE__VARIANTS:
        return getVariants();
      case UsecasesPackage.USE_CASE__ISSUES:
        return getIssues();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case UsecasesPackage.USE_CASE__NAME:
        setName((String)newValue);
        return;
      case UsecasesPackage.USE_CASE__DESCRIPTION:
        setDescription((String)newValue);
        return;
      case UsecasesPackage.USE_CASE__SCOPE:
        setScope((Scope)newValue);
        return;
      case UsecasesPackage.USE_CASE__LEVEL:
        setLevel((Level)newValue);
        return;
      case UsecasesPackage.USE_CASE__PRIMARY_ACTOR:
        setPrimaryActor((Actor)newValue);
        return;
      case UsecasesPackage.USE_CASE__SECONDARY_ACTORS:
        getSecondaryActors().clear();
        getSecondaryActors().addAll((Collection<? extends Actor>)newValue);
        return;
      case UsecasesPackage.USE_CASE__TERTIARY_ACTORS:
        getTertiaryActors().clear();
        getTertiaryActors().addAll((Collection<? extends Actor>)newValue);
        return;
      case UsecasesPackage.USE_CASE__INTERESTS:
        getInterests().clear();
        getInterests().addAll((Collection<? extends Interest>)newValue);
        return;
      case UsecasesPackage.USE_CASE__PRECONDITIONS:
        getPreconditions().clear();
        getPreconditions().addAll((Collection<? extends Condition>)newValue);
        return;
      case UsecasesPackage.USE_CASE__POSTCONDITIONS:
        getPostconditions().clear();
        getPostconditions().addAll((Collection<? extends Condition>)newValue);
        return;
      case UsecasesPackage.USE_CASE__INVARIANTS:
        getInvariants().clear();
        getInvariants().addAll((Collection<? extends Condition>)newValue);
        return;
      case UsecasesPackage.USE_CASE__TRIGGER:
        setTrigger((Trigger)newValue);
        return;
      case UsecasesPackage.USE_CASE__STEPS:
        getSteps().clear();
        getSteps().addAll((Collection<? extends ActionStep>)newValue);
        return;
      case UsecasesPackage.USE_CASE__EXTENSIONS:
        getExtensions().clear();
        getExtensions().addAll((Collection<? extends Extension>)newValue);
        return;
      case UsecasesPackage.USE_CASE__VARIANTS:
        getVariants().clear();
        getVariants().addAll((Collection<? extends Variant>)newValue);
        return;
      case UsecasesPackage.USE_CASE__ISSUES:
        getIssues().clear();
        getIssues().addAll((Collection<? extends Issue>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case UsecasesPackage.USE_CASE__NAME:
        setName(NAME_EDEFAULT);
        return;
      case UsecasesPackage.USE_CASE__DESCRIPTION:
        setDescription(DESCRIPTION_EDEFAULT);
        return;
      case UsecasesPackage.USE_CASE__SCOPE:
        setScope((Scope)null);
        return;
      case UsecasesPackage.USE_CASE__LEVEL:
        setLevel(LEVEL_EDEFAULT);
        return;
      case UsecasesPackage.USE_CASE__PRIMARY_ACTOR:
        setPrimaryActor((Actor)null);
        return;
      case UsecasesPackage.USE_CASE__SECONDARY_ACTORS:
        getSecondaryActors().clear();
        return;
      case UsecasesPackage.USE_CASE__TERTIARY_ACTORS:
        getTertiaryActors().clear();
        return;
      case UsecasesPackage.USE_CASE__INTERESTS:
        getInterests().clear();
        return;
      case UsecasesPackage.USE_CASE__PRECONDITIONS:
        getPreconditions().clear();
        return;
      case UsecasesPackage.USE_CASE__POSTCONDITIONS:
        getPostconditions().clear();
        return;
      case UsecasesPackage.USE_CASE__INVARIANTS:
        getInvariants().clear();
        return;
      case UsecasesPackage.USE_CASE__TRIGGER:
        setTrigger((Trigger)null);
        return;
      case UsecasesPackage.USE_CASE__STEPS:
        getSteps().clear();
        return;
      case UsecasesPackage.USE_CASE__EXTENSIONS:
        getExtensions().clear();
        return;
      case UsecasesPackage.USE_CASE__VARIANTS:
        getVariants().clear();
        return;
      case UsecasesPackage.USE_CASE__ISSUES:
        getIssues().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case UsecasesPackage.USE_CASE__NAME:
        return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
      case UsecasesPackage.USE_CASE__DESCRIPTION:
        return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
      case UsecasesPackage.USE_CASE__SCOPE:
        return scope != null;
      case UsecasesPackage.USE_CASE__LEVEL:
        return level != LEVEL_EDEFAULT;
      case UsecasesPackage.USE_CASE__PRIMARY_ACTOR:
        return primaryActor != null;
      case UsecasesPackage.USE_CASE__SECONDARY_ACTORS:
        return secondaryActors != null && !secondaryActors.isEmpty();
      case UsecasesPackage.USE_CASE__TERTIARY_ACTORS:
        return tertiaryActors != null && !tertiaryActors.isEmpty();
      case UsecasesPackage.USE_CASE__INTERESTS:
        return interests != null && !interests.isEmpty();
      case UsecasesPackage.USE_CASE__PRECONDITIONS:
        return preconditions != null && !preconditions.isEmpty();
      case UsecasesPackage.USE_CASE__POSTCONDITIONS:
        return postconditions != null && !postconditions.isEmpty();
      case UsecasesPackage.USE_CASE__INVARIANTS:
        return invariants != null && !invariants.isEmpty();
      case UsecasesPackage.USE_CASE__TRIGGER:
        return trigger != null;
      case UsecasesPackage.USE_CASE__STEPS:
        return steps != null && !steps.isEmpty();
      case UsecasesPackage.USE_CASE__EXTENSIONS:
        return extensions != null && !extensions.isEmpty();
      case UsecasesPackage.USE_CASE__VARIANTS:
        return variants != null && !variants.isEmpty();
      case UsecasesPackage.USE_CASE__ISSUES:
        return issues != null && !issues.isEmpty();
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (name: ");
    result.append(name);
    result.append(", description: ");
    result.append(description);
    result.append(", level: ");
    result.append(level);
    result.append(')');
    return result.toString();
  }

} //UseCaseImpl
